import { FlowNodeTypeEnum } from '/@/enums/workFlowEnum';

// export interface EasyFlowNodeAudit {
// 	type: Number;
// 	name: String;
// 	makerList: Array<any>;
// }

export interface IWorkFlowNode {
	nodeId: string;
	parentId: Nullable<string>;
	//节点名称
	nodeName: String;
	//节点类型
	type: FlowNodeTypeEnum;
	/**
	 * 节点是否已经配置
	 */
	isConfig: Boolean;
	//节点描述
	nodeRemark: String;
	//节点优先级
	priorityLevel: Number;
	//条件设置
	conditionList: Array<any>;
	//条件集合
	conditionNodes: Array<IWorkFlowNode>;
	childNode?: Nullable<IWorkFlowNode>;
	nodeUserList: Array<any>;
	isDefault: Boolean;
	// auditList?: Array<IWorkFlowNode>;
	//审批方式
	//approvalMethod?: Number;
	//审批人与发起人为同一人时
	// auditUserEq?: Number;
	//审批人为空时
	// auditEmpty?: Number;
	// //抄送用户
	// ccUsers?: Array<any>;
	//extraData?: any;
}

export class WorkFlowNode implements IWorkFlowNode {
	nodeId: string;
	parentId: Nullable<string>;
	nodeName: string;
	type: FlowNodeTypeEnum;
	isConfig: boolean;
	nodeRemark: string;
	priorityLevel: number;
	conditionList: Array<any>;
	conditionNodes: Array<WorkFlowNode>;
	childNode?: Nullable<WorkFlowNode>;
	nodeUserList: Array<any>;
	isDefault: boolean = false;

	constructor(
		nodeId: string,
		parentId: string | null = null,
		nodeName: string,
		type: FlowNodeTypeEnum,
		childNode: Nullable<WorkFlowNode> = null,
		conditionList: Array<any> = [],
		priorityLevel: number = 0,
		nodeRemark: string = '',
		isConfig: boolean = false,
		conditionNodes: Array<WorkFlowNode> = [],
		nodeUserList: Array<any> = [],
		isDefault: boolean = false
	) {
		this.nodeId = nodeId;
		this.parentId = parentId;
		this.nodeName = nodeName;
		this.type = type;
		this.isConfig = isConfig;
		this.nodeRemark = nodeRemark;
		this.priorityLevel = priorityLevel;
		this.conditionList = conditionList;
		this.conditionNodes = conditionNodes;
		this.nodeUserList = nodeUserList;
		this.childNode = childNode;
		this.isDefault = isDefault;
	}
}
